﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.ShaderTagId
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Shader tag ids are used to refer to various names in shaders.</para>
  /// </summary>
  /// <summary>
  ///   <para>Gets or creates a shader tag id representing the given name.</para>
  /// </summary>
  /// <param name="name">The name to represent with the shader tag id.</param>
  public struct ShaderTagId(string name) : IEquatable<ShaderTagId>
  {
    /// <summary>
    ///   <para>Describes a shader tag id not referring to any name.</para>
    /// </summary>
    public static readonly ShaderTagId none;
    private int m_Id = Shader.TagToID(name);

    internal int id
    {
      get => this.m_Id;
      set => this.m_Id = value;
    }

    /// <summary>
    ///   <para>Gets the name of the tag referred to by the shader tag id.</para>
    /// </summary>
    public string name => Shader.IDToTag(this.id);

    public override bool Equals(object obj) => obj is ShaderTagId other && this.Equals(other);

    public bool Equals(ShaderTagId other) => this.m_Id == other.m_Id;

    public override int GetHashCode() => 2079669542 * -1521134295 + this.m_Id.GetHashCode();

    public static bool operator ==(ShaderTagId tag1, ShaderTagId tag2) => tag1.Equals(tag2);

    public static bool operator !=(ShaderTagId tag1, ShaderTagId tag2) => !(tag1 == tag2);

    public static explicit operator ShaderTagId(string name) => new ShaderTagId(name);

    public static explicit operator string(ShaderTagId tagId) => tagId.name;
  }
}
